package data

var Mysid string
var StatusToCtlFlag int //1 WGCTL,0 RabbitMq
var TlsTurn int         //  tls版本开关，0：最小版本0  1：最小版本 TLS1.2
var KafkaTopic901 string
var KafkaTopic201 string
var KafkaTopic903 string

var SendMsgTimeout int = -1
var WriteTimeout int = -1

var AuthIp string
var AuthPort string

const MUX_MSG_LEN = 2048
const MULTDEVICETYPE = 1 //一拖多设备
const CHECKSTRLEN = 10

const DEVICE_AUTHENTICATION = 101
const EXCHANGE_ENCRYPTION_KEY = 102
const RETRIVE_SYSTEM_CONFIG = 103
const SEND_CONTROL_COMMAND = 201
const SEND_QUERY_COMMAND = 202
const SEND_CONTROL_RERET = 203
const QUERY_VERSON_COMMAND = 301
const SEND_OTA_COMMAND = 302
const QUERY_OTA_COMMAND = 303
const SEND_MCU_UPGRADE_COMMAND = 305
const SEND_COMMON_COMMAND = 310
const REPORT_COMMON_COMMAND = 312
const BIND_DEV_COMMAND = 401
const UNBIND_DEV_COMMAND = 402
const GET_BIND_DEV_COMMAND = 403
const GET_HOME_DEVLIST_COMMAND = 404
const SEND_DEVINFO_CHANGE_COMMAND = 405
const DEVICE_EXTINFO_STORE = 406
const DEVICE_RESET = 407
const GET_SCENE_LIST_COMMAND = 501
const GET_SCENE_INFO_COMMAND = 502
const SEND_SCENE_MODIFY_COMMAND = 503
const SEND_SCENE_EXE_COMMAND = 504
const SEND_CONFIG_DATA_COMMAND = 601
const REPORT_CONFIG_DATA = 602
const REPORT_STATUS_COMMAND = 901
const REPORT_HEARTBEAT_COMMAND = 902
const REPORT_STATUS_UPDATE = 903

type CmdExecResult struct {
	//指令执行结果
	deviceid string
	retno    int
	retmsg   string
}

// 为类型添加方法.get获取参数值,set设置参数值
func (hd *CmdExecResult) SetDeviceid(deviceid string) {
	hd.deviceid = deviceid
}
func (hd *CmdExecResult) GetDeviceid() string {
	return hd.deviceid
}
func (hd *CmdExecResult) SetRetno(retno int) {
	hd.retno = retno
}
func (hd *CmdExecResult) GetRetno() int {
	return hd.retno
}
func (hd *CmdExecResult) SetRetmsg(retmsg string) {
	hd.retmsg = retmsg
}
func (hd *CmdExecResult) GetRetmsg() string {
	return hd.retmsg
}

type RawWGCommonStatus struct {
	//状态数据
	msgtype    int
	msgsubtype int
	rawstatus  string
}

// 为类型添加方法.get方法获取参数值,set方法设置参数值
func (hd *RawWGCommonStatus) SetMsgtype(msgtype int) {
	hd.msgtype = msgtype
}
func (hd *RawWGCommonStatus) GetMsgtype() int {
	return hd.msgtype
}
func (hd *RawWGCommonStatus) SetMsgsubtype(msgsubtype int) {
	hd.msgsubtype = msgsubtype
}
func (hd *RawWGCommonStatus) GetMsgsubtype() int {
	return hd.msgsubtype
}
func (hd *RawWGCommonStatus) SetRawstatus(rawstatus string) {
	hd.rawstatus = rawstatus
}
func (hd *RawWGCommonStatus) GetRawstatus() string {
	return hd.rawstatus
}

type RawWGCommonCmd struct {
	//指令数据
	devid     string
	com       string
	cmdverion int
}

// 为类型添加方法.get方法获取参数值,set方法设置参数值
func (hd *RawWGCommonCmd) SetDeviceId(devid string) {
	hd.devid = devid
}
func (hd *RawWGCommonCmd) GetDeviceId() string {
	return hd.devid
}
func (hd *RawWGCommonCmd) SetCom(com string) {
	hd.com = com
}
func (hd *RawWGCommonCmd) GetCom() string {
	return hd.com
}
func (hd *RawWGCommonCmd) SetCmdverion(cmdverion int) {
	hd.cmdverion = cmdverion
}
func (hd *RawWGCommonCmd) GetCmdverion() int {
	return hd.cmdverion
}

type DeviceData struct {
	//设备状态数据
	deviceid string
	value    string
}

// 为类型添加方法.
// get方法获取参数值,set方法设置参数值
func (hd *DeviceData) SetDeviceId(deviceid string) {
	hd.deviceid = deviceid
}
func (hd *DeviceData) GetDeviceId() string {
	return hd.deviceid
}
func (hd *DeviceData) SetValue(value string) {
	hd.value = value
}
func (hd *DeviceData) GetValue() string {
	return hd.value
}

type RoomInfo struct {
	//房间信息
	roomId     int
	roomName   string
	roomDesc   string
	floorId    int
	roomImgUrl string
}
type HomeDevice struct {
	//家庭设备信息
	wifiId            string
	wifiModuleType    int
	mutiDevice        int
	deviceId          string
	deviceTypeCode    string
	deviceSubTypeCode string
	status            int
	bindDate          string
	barCode           string
	roomInfo          []RoomInfo
	deviceCode        string
	deviceName        string
	deviceTypeName    string
}

// 为类型添加方法.
// get方法获取参数值,set方法设置参数值
func (hd *HomeDevice) SetWifiId(wifiid string) {
	hd.wifiId = wifiid
}
func (hd *HomeDevice) GetWifiId() string {
	return hd.wifiId
}

func (hd *HomeDevice) SetDeviceId(deviceid string) {
	hd.deviceId = deviceid
}
func (hd *HomeDevice) GetDeviceId() string {
	return hd.deviceId
}
func (hd *HomeDevice) SetDeviceTypeCode(devicetypecode string) {
	hd.deviceTypeCode = devicetypecode
}
func (hd *HomeDevice) GetDeviceTypeCode() string {
	return hd.deviceTypeCode
}

// 场景相关数据结构定义
type SceneIdInfo struct {
	//场景ID信息
	sceneId    int
	sceneType  int
	updatetime int
}

// 为类型添加方法.
// get方法获取参数值,set方法设置参数值
func (hd *SceneIdInfo) SetSceneId(sceneid int) {
	hd.sceneId = sceneid
}
func (hd *SceneIdInfo) GetSceneId() int {
	return hd.sceneId
}
func (hd *SceneIdInfo) SetSceneType(scenetype int) {
	hd.sceneType = scenetype
}
func (hd *SceneIdInfo) GetSceneType() int {
	return hd.sceneType
}
func (hd *SceneIdInfo) SetUpdateTime(updatetime int) {
	hd.updatetime = updatetime
}
func (hd *SceneIdInfo) GetUpdateTime() int {
	return hd.updatetime
}

type Cmd struct {
	//指令信息
	cmdOrder  int
	cmdId     int
	cmdParam  int
	deviceId  string
	wifiId    string
	delayTime int
}

func (hd *Cmd) SetCmdOrder(cmdorder int) {
	hd.cmdOrder = cmdorder
}
func (hd *Cmd) GetCmdOrder() int {
	return hd.cmdOrder
}

func (hd *Cmd) SetCmdId(cmdid int) {
	hd.cmdId = cmdid
}
func (hd *Cmd) GetCmdId() int {
	return hd.cmdId
}

func (hd *Cmd) SetCmdParam(cmdParam int) {
	hd.cmdParam = cmdParam
}
func (hd *Cmd) GetCmdParam() int {
	return hd.cmdParam
}

func (hd *Cmd) SetDeviceId(deviceid string) {
	hd.deviceId = deviceid
}
func (hd *Cmd) GetDeviceId() string {
	return hd.deviceId
}

func (hd *Cmd) SetWifiId(wifiid string) {
	hd.wifiId = wifiid
}
func (hd *Cmd) GetWifiId() string {
	return hd.wifiId
}

func (hd *Cmd) SetDelayTime(delaytime int) {
	hd.delayTime = delaytime
}
func (hd *Cmd) GetDelayTime() int {
	return hd.delayTime
}

type SceneCondition struct {
	//场景条件信息
	sceneConditionId int
	deviceId         string
	wifiId           string
	statusValue      int
	operateType      int
	statusParamValue int
}

func (hd *SceneCondition) SetSceneConditionId(sceneConditionId int) {
	hd.sceneConditionId = sceneConditionId
}
func (hd *SceneCondition) GetSceneConditionId() int {
	return hd.sceneConditionId
}

func (hd *SceneCondition) SetDeviceId(deviceId string) {
	hd.deviceId = deviceId
}
func (hd *SceneCondition) GetDeviceId() string {
	return hd.deviceId
}

func (hd *SceneCondition) SetWifiId(wifiId string) {
	hd.wifiId = wifiId
}
func (hd *SceneCondition) GetWifiId() string {
	return hd.wifiId
}

func (hd *SceneCondition) SetStatusValue(statusValue int) {
	hd.statusValue = statusValue
}
func (hd *SceneCondition) GetStatusValue() int {
	return hd.statusValue
}

func (hd *SceneCondition) SetOperateType(operateType int) {
	hd.operateType = operateType
}
func (hd *SceneCondition) GetOperateType() int {
	return hd.operateType
}

func (hd *SceneCondition) SetStatusParamValue(statusParamValue int) {
	hd.statusParamValue = statusParamValue
}
func (hd *SceneCondition) GetStatusParamValue() int {
	return hd.statusParamValue
}

type SceneValidTime struct {
	//场景有效时间信息
	startTime string
	endTime   string
}

func (hd *SceneValidTime) SetStartTime(startTime string) {
	hd.startTime = startTime
}
func (hd *SceneValidTime) GetStartTime() string {
	return hd.startTime
}

func (hd *SceneValidTime) SetEndTime(endTime string) {
	hd.endTime = endTime
}
func (hd *SceneValidTime) GetEndTime() string {
	return hd.endTime
}

type Scene struct {
	//场景信息
	sceneId            int
	homeId             int
	sceneName          string
	sceneType          int
	status             int
	cmdlist            []Cmd
	sceneConditionList []SceneCondition
	updatetime         int
	conSceneId         int
	scenceIconId       int
	scenceIconUrl      string
	sceneExeCycle      int
	sceneExeDate       string
	sceneExeTime       string
	conrelation        int
	validTimeList      []SceneValidTime
}

func (hd *Scene) SetCmdList(cmd []Cmd) {
	hd.cmdlist = cmd
}
func (hd *Scene) GetCmdList() []Cmd {
	return hd.cmdlist
}

func (hd *Scene) SetSceneConditionList(sceneConditionList []SceneCondition) {
	hd.sceneConditionList = sceneConditionList
}
func (hd *Scene) GetSceneConditionList() []SceneCondition {
	return hd.sceneConditionList
}

func (hd *Scene) SetValidTimeList(validTimeList []SceneValidTime) {
	hd.validTimeList = validTimeList
}
func (hd *Scene) GetValidTimeList() []SceneValidTime {
	return hd.validTimeList
}

func (hd *Scene) SetSceneId(sceneId int) {
	hd.sceneId = sceneId
}
func (hd *Scene) GetSceneId() int {
	return hd.sceneId
}

func (hd *Scene) SetHomeId(homeId int) {
	hd.homeId = homeId
}
func (hd *Scene) GetHomeId() int {
	return hd.homeId
}

func (hd *Scene) SetSceneName(sceneName string) {
	hd.sceneName = sceneName
}
func (hd *Scene) GetSceneName() string {
	return hd.sceneName
}

func (hd *Scene) SetSceneType(sceneType int) {
	hd.sceneType = sceneType
}
func (hd *Scene) GetSceneType() int {
	return hd.sceneType
}

func (hd *Scene) SetStatus(status int) {
	hd.status = status
}
func (hd *Scene) GetStatus() int {
	return hd.status
}

func (hd *Scene) SetUpdatetime(updatetime int) {
	hd.updatetime = updatetime
}
func (hd *Scene) GetUpdatetime() int {
	return hd.updatetime
}

func (hd *Scene) SetConSceneId(conSceneId int) {
	hd.conSceneId = conSceneId
}
func (hd *Scene) GetConSceneId() int {
	return hd.conSceneId
}

func (hd *Scene) SetConrelation(conrelation int) {
	hd.conrelation = conrelation
}
func (hd *Scene) GetConrelation() int {
	return hd.conrelation
}

// xwj add begin 2018/10/25
type WGPSstats struct {
	Wifiid      string      `json:"wifiid"`
	OwnerServer string      `json:"owner"`
	PeerAddr    string      `json:"peeraddr"`
	WifiVersion string      `json:"wifiver"`
	Stat        int64       `json:"stat"`
	NetId       int32       `json:"netid"`
	Protocol    string      `json:"protocol"`
	DevVer      []DeviceVer `json:"deviceVer"`
	ProtVer     string      `json:"protVer"`
}
type InWgotaCheckVerReqT struct {
	MsgVer int16  `json:"msgVer"`
	DvcID  string `json:"dvcId"`
}
type Token struct {
	SubscriberId int64         `json:"subscriberId"`
	CustomerId   int64         `json:"customerId"`
	AppId        string        `json:"appId"`
	DeviceId     string        `json:"deviceId"`
	LanguageId   int32         `json:"languageId"`
	SourceType   int16         `json:"sourceType"`
	Version      float64       `json:"version"`
	CustomerInfo *CustomerInfo `json:"customerInfo"`
}
type CustomerInfo struct {
	PlatformId int64  `json:"platformId"`
	CustomerId string `json:"customerId"`
}

// xwj add end 2018/10/25
type DeviceVer struct {
	SysType  string `json:"sysType"`
	Ver      string `json:"ver"`
	Checksum string `json:"checksum"`
}
